package tgc.edu.tms.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import tgc.edu.tms.custom.CommonRepository;
import tgc.edu.tms.entity.TbClass;
@Repository
public interface TbClassRepository extends CommonRepository<TbClass, Integer> {
	
	List<TbClass> findByProfession_id(Integer proId);
	@Query(value="SELECT DISTINCT * FROM tb_class WHERE profession_id=?1 AND name=?2",nativeQuery=true)
	TbClass findBytbclassandprofesion(String profesion, String tbclass);
	@Query(value="SELECT * FROM tb_class WHERE profession_id=?1",nativeQuery=true)
	List<TbClass> findByprofessionID(Integer professionid);
	@Query(value="select count(*) from student where tb_class_id=?1",nativeQuery=true)
	Integer findtiaoshu(Integer id2);
	@Query(value="SELECT * FROM tb_class WHERE name=?1",nativeQuery=true)
	TbClass findByTbclass(String tbclass);
	@Query(value="SELECT * FROM tb_class WHERE profession_id=?1 and name=?2",nativeQuery=true)
	TbClass findByProfessionIDAndtbclassName(Integer id, String tbclassname);
	@Query(value="SELECT * from tb_class WHERE name=?1 AND profession_id=?2",nativeQuery=true)
	TbClass findByNameAndProfession(String name ,Integer id);



	

}
